<?php

namespace App\Console\Commands;

use App\Repositories\FootWorkRepository;
use Illuminate\Console\Command;

class SyncReportCommand extends Command
{
    /**
     * The name and signature of the console command.
     *
     * @var string
     */
    protected $signature = 'report:sync {id?}';

    /**
     * The console command description.
     *
     * @var string
     */
    protected $description = '同步报告到芯迈';

    /**
     * Create a new command instance.
     *
     * @return void
     */
    public function __construct()
    {
        parent::__construct();
    }

    /**
     * Execute the console command.
     *
     * @return mixed
     */
    public function handle()
    {
        $data = [];
        $id = $this->argument('id');
        if(!empty($id)){
            $data['id'] = $id;
        }
        $ret =  (new FootWorkRepository())->syncTofwlab($data);
        $this->info(json_encode($ret, JSON_UNESCAPED_UNICODE));
        return $ret;
    }
}
